package reader;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public abstract class Reader {
	
	protected BufferedReader getBufferedReader(int x, int y, int z) throws FileNotFoundException {
		FileReader fReader = 
			new FileReader(getFile_directory() + "/" + getFile_name_prefix() + "_" + x + "_" + y + "_" + z);
	   
	    BufferedReader bfReader = new BufferedReader(fReader);
	    
	    return bfReader;
	}
	
	protected BufferedWriter getBufferedWriter(int x, int y, int z) throws IOException {
		FileWriter fWriter = 
			new FileWriter(getFile_directory() + "/" + getFile_name_prefix() + "_" + x + "_" + y + "_" + z);
        
		BufferedWriter bfWriter = new BufferedWriter(fWriter);
        
        return bfWriter;
	}
	
	/**
	 * This abstract method needs to be implemented in the subclass
	 * @return the file's directory
	 */
	public abstract String getFile_directory();
	
	/**
	 * This abstract method needs to be implemented in the subclass
	 * @return the file's name prefix
	 */
	public abstract String getFile_name_prefix();
}

